<template>
	<view>
		<u-popup  v-model="show" mode='center' class="popup-show" :border-radius='10' :z-index="99999999"  :mask-close-able='false'>
			<view class="content">
				<scroll-view scroll-y="true" style="height: 50vh;padding-bottom: 30rpx;">
					<view class="node-box">
						<rich-text :nodes="data"></rich-text>
					</view>
					
				</scroll-view>
				<view class="confrim-btn" @click="closed">
					我知道了
					<!-- <u-button @click="show = false;">我知道了</u-button> -->
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props : {
			show: {
				type: Boolean,
				default: function() {
					return false;
				}
			},
			type: {
				type: String,
				default: function() {
					return 'user_agreement';
					// privacy_policy
				}
			},
		},
		created() {
			this.getData()
		},
		data() {
			return {
				data: ''
			}
		},
		methods : {
			closed(){
				this.$emit('close' )
			},
			getData() {
				this.$http({
					url: "api/common/get_agreement",
					data: {
						name: this.type
					}
				}).then(res => {
					console.log(res);
					if (res.data.code == 1) {
						this.data = res.data.data.content
					} else {
						this.$tip.tip(res.data.msg)
					}
				}).catch(err => {});
			}
		}
	}
</script>

<style scoped>
	.content{
		width: 560rpx;
		background-color: #fff;
		padding-bottom: 30rpx;
		color: #000;
		position: relative;
		z-index: 9;
	}
	.confrim-btn{
		width: 510rpx;
		color: #fff;
		background-color: #9400D3;
		height: 80rpx;
		border-radius: 40rpx;
		text-align: center;
		line-height: 80rpx;
		margin-left: 25rpx;
		/* margin: 25rpx; */
	}
	.node-box {
		width: 560rpx;
		padding: 50rpx;
		box-sizing: border-box;
	}
</style>
